﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using Model;
using System.ComponentModel.DataAnnotations.Schema;
using Swashbuckle.AspNetCore.Annotations;

namespace Model
{
    /// <summary>
    /// 权限资源中间表，多对多用哪到
    ///https://docs.microsoft.com/zh-cn/ef/core/modeling/relationships?tabs=fluent-api%2Cfluent-api-simple-key%2Csimple-key
    /// </summary>
    [Serializable]
    [Table("AuthorityRes")]
    public class AuthorityRes : UserID
    {
        /// <summary>
        /// 权限id
        /// </summary>
        public int AuthorityId { get; set; }
        /// <summary>
        /// 权限对象。客户端做增加修改时不需要给此属性赋值（修改对应的authorityId即可）
        /// </summary>
        [SwaggerSchema(ReadOnly = true)]
        public virtual Authority Authority { get; set; }
        /// <summary>
        /// 资源id
        /// </summary>
        public int ResId { get; set; }
        /// <summary>
        /// 资源对象。客户端做增加修改时不需要给此属性赋值（修改对应的resId即可）
        /// </summary>
        [SwaggerSchema(ReadOnly = true)]
        public virtual Res Res { get; set; }
    }
}